import axios from '@/utils/axios.js'

// 获取用户列表 - post
// axios post请求传参:  { }
// axios get请求传参: params:{}
export const getUsers = params =>
  axios({
    method: 'GET',
    url: 'users',
    params: params
  })

// 修改用户状态
// 请求路径：users/:uId/state/:type
export const updateUserState = (uid, type) =>
  axios({
    url: `users/${uid}/state/${type}`,
    method: 'PUT'
  })

// 用户新增保存
export const addSave = data =>
  axios({
    url: 'users',
    method: 'POST',
    data
  })

// 请求路径：users/:id
// 用户修改保存
export const editSave = data =>
  axios({
    url: `users/${data.editId}`,
    method: 'PUT',
    data
  })

// 删除用户
export const deleteUser = id =>
  axios({
    url: `users/${id}`,
    method: 'delete'
  })
